package marek.barak.classes;

import java.io.Serializable;

public class User implements Serializable{

	private static final long serialVersionUID = -5321891255318057385L;
	private String name;
	private String surName;
	public User(String name, String surname){
		this.name = name;
		this.surName = surname;
	}
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getSurName() {
		return surName;
	}
	public void setSurName(String surName) {
		this.surName = surName;
	}
	@Override
	public String toString(){
		return this.name + " " + this.surName;
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result + ((surName == null) ? 0 : surName.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if(obj instanceof User)
			return (this.surName.equals(((User)obj).getSurName())? true:(this.getName().equals(((User)obj).getName())));
		else
		return false;
	}

}
